package Job202213;

import java.text.DecimalFormat;

public class Job3 {
    //4. 将一个数字字符串转换成逗号分隔的数字串，即从右边开始每三个数字用逗号分隔
    public static void main(String[] args) {
        String s="12345642345";
        StringBuilder b = new StringBuilder(s);
        for(int i =s.length()-3;i>=0;i-=3 ){
            b.insert(i, ",");
        }
        System.out.println(b);

        DecimalFormat df = new DecimalFormat("#,###");
        System.out.println(df.format(Double.parseDouble(s)));

    }
}
